using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vIprcptMap : EntityTypeConfiguration<vIprcpt>
    {
        public vIprcptMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.TYPE, t.DATE, t.LOCATION, t.QTY, t.CURRENCY, t.COST, t.EXTEND, t.INVNO, t.MKGSTOTAL, t.COST2, t.COST1, t.RetailPrice, t.IsFixedAsset });

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.TYPE)
                .IsRequired()
                .HasMaxLength(1);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.LOCATION)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.PONUMBER)
                .HasMaxLength(10);

            this.Property(t => t.CURRENCY)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.EXPDATE)
                .HasMaxLength(6);

            this.Property(t => t.INVNO)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.MANUFACCODE)
                .HasMaxLength(15);

            this.Property(t => t.CUSTOM1)
                .HasMaxLength(6);

            this.Property(t => t.CUSTOM2)
                .HasMaxLength(6);

            this.Property(t => t.DESC)
                .HasMaxLength(50);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            this.Property(t => t.ReceiptReference)
                .HasMaxLength(7);

            this.Property(t => t.Receiptinvoicenb)
                .HasMaxLength(8);

            // Table & Column Mappings
            this.ToTable("vIprcpts");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.PONUMBER).HasColumnName("PONUMBER");
            this.Property(t => t.QTY).HasColumnName("QTY");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.FACTOR).HasColumnName("FACTOR");
            this.Property(t => t.EXTEND).HasColumnName("EXTEND");
            this.Property(t => t.CLOSEPO).HasColumnName("CLOSEPO");
            this.Property(t => t.POSTED).HasColumnName("POSTED");
            this.Property(t => t.EXPDATE).HasColumnName("EXPDATE");
            this.Property(t => t.INVNO).HasColumnName("INVNO");
            this.Property(t => t.QTYREMAIN).HasColumnName("QTYREMAIN");
            this.Property(t => t.QTYREMAGW).HasColumnName("QTYREMAGW");
            this.Property(t => t.POENTRY_NO).HasColumnName("POENTRY_NO");
            this.Property(t => t.GROSSWGHT).HasColumnName("GROSSWGHT");
            this.Property(t => t.PUREWGHT).HasColumnName("PUREWGHT");
            this.Property(t => t.PUREVALUE).HasColumnName("PUREVALUE");
            this.Property(t => t.MKGSPERGRM).HasColumnName("MKGSPERGRM");
            this.Property(t => t.MKGSTOTAL).HasColumnName("MKGSTOTAL");
            this.Property(t => t.PURITY).HasColumnName("PURITY");
            this.Property(t => t.COST2).HasColumnName("COST2");
            this.Property(t => t.COST1).HasColumnName("COST1");
            this.Property(t => t.MANUFACCODE).HasColumnName("MANUFACCODE");
            this.Property(t => t.ITEMTYPE).HasColumnName("ITEMTYPE");
            this.Property(t => t.ITEMCATEGORY).HasColumnName("ITEMCATEGORY");
            this.Property(t => t.MASTERITEM).HasColumnName("MASTERITEM");
            this.Property(t => t.MASTERITEMID).HasColumnName("MASTERITEMID");
            this.Property(t => t.CUSTOM1).HasColumnName("CUSTOM1");
            this.Property(t => t.CUSTOM2).HasColumnName("CUSTOM2");
            this.Property(t => t.RetailPrice).HasColumnName("RetailPrice");
            this.Property(t => t.DISCOUNT).HasColumnName("DISCOUNT");
            this.Property(t => t.COSTBEFOREDISC).HasColumnName("COSTBEFOREDISC");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.DISCOUNTPERCENT).HasColumnName("DISCOUNTPERCENT");
            this.Property(t => t.WholePrice).HasColumnName("WholePrice");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.ExpiryDate).HasColumnName("ExpiryDate");
            this.Property(t => t.IsFixedAsset).HasColumnName("IsFixedAsset");
            this.Property(t => t.LineTax).HasColumnName("LineTax");
            this.Property(t => t.VAT_Enabled).HasColumnName("VAT_Enabled");
            this.Property(t => t.LandedExtend).HasColumnName("LandedExtend");
            this.Property(t => t.UOFMORDERS).HasColumnName("UOFMORDERS");
            this.Property(t => t.ReceiptReference).HasColumnName("ReceiptReference");
            this.Property(t => t.Receiptinvoicenb).HasColumnName("Receiptinvoicenb");
            this.Property(t => t.ReceiptDate).HasColumnName("ReceiptDate");
        }
    }
}
